home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / VER.H < prev    next >
C/C++ Source or Header  |  1993-11-23  |  9KB  |  256 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * ver.h -       Version management functions, types, and definitions          *
  4. *                                                                             *
  5. *               Include file for VER.DLL and VER.LIB.  These libraries are    *
  6. *               designed to allow version stamping of Windows executable files*
  7. *               and of special .VER files for DOS executable files.           *
  8. *                                                                             *
  9. *               The API is unchanged for LIB and DLL versions.                *
  10. *                                                                             *
  11. *               Copyright (c) 1992, Microsoft Corp.  All rights reserved      *
  12. *                                                                             *
  13. *******************************************************************************
  14. *
  15. * #define LIB   - To be used with VER.LIB (default is for VER.DLL)
  16. *
  17. \*****************************************************************************/
  18.  
  19. #ifndef _INC_VER
  20. #define _INC_VER
  21.  
  22. #ifndef RC_INVOKED
  23. #pragma pack(1)         /* Assume byte packing throughout */
  24. #endif /* RC_INVOKED */
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {            /* Assume C declarations for C++ */
  28. #endif    /* __cplusplus */
  29.  
  30. /*
  31.  * If .lib version is being used, declare types used in this file.
  32.  */
  33. #ifdef LIB
  34.  
  35. #ifndef WINAPI                      /* don't declare if they're already declared */
  36. #define WINAPI      _far _pascal
  37. #define NEAR        _near
  38. #define FAR         _far
  39. #define PASCAL      _pascal
  40. typedef int             BOOL;
  41. #define TRUE        1
  42. #define FALSE       0
  43. typedef unsigned char   BYTE;
  44. typedef unsigned short  WORD;
  45. typedef unsigned int    UINT;
  46. typedef signed long     LONG;
  47. typedef unsigned long   DWORD;
  48. typedef char far*       LPSTR;
  49. typedef const char far* LPCSTR;
  50. typedef int             HFILE;
  51. #define OFSTRUCT    void            /* Not used by the .lib version */
  52. #define LOWORD(l)        ((WORD)(l))
  53. #define HIWORD(l)        ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
  54. #define MAKEINTRESOURCE(i)    (LPSTR)((DWORD)((WORD)(i)))
  55. #endif  /* WINAPI */
  56.  
  57. #else   /* LIB */
  58.  
  59. /* If .dll version is being used and we're being included with
  60.  * the 3.0 windows.h, #define compatible type aliases.
  61.  * If included with the 3.0 windows.h, #define compatible aliases
  62.  */
  63. #ifndef _INC_WINDOWS
  64. #define UINT        WORD
  65. #define LPCSTR      LPSTR
  66. #define HFILE       int
  67. #endif  /* !_INC_WINDOWS */
  68.  
  69. #endif  /* !LIB */
  70.  
  71. /* ----- RC defines ----- */
  72. #ifdef RC_INVOKED
  73. #define ID(id)            id
  74. #else
  75. #define ID(id)            MAKEINTRESOURCE(id)
  76. #endif
  77.  
  78. /* ----- Symbols ----- */
  79. #define VS_FILE_INFO        ID(16)        /* Version stamp res type */
  80. #define VS_VERSION_INFO        ID(1)          /* Version stamp res ID */
  81. #define VS_USER_DEFINED        ID(100)        /* User-defined res IDs */
  82.  
  83. /* ----- VS_VERSION.dwFileFlags ----- */
  84. #define    VS_FFI_SIGNATURE    0xFEEF04BDL
  85. #define    VS_FFI_STRUCVERSION    0x00010000L
  86. #define    VS_FFI_FILEFLAGSMASK    0x0000003FL
  87.  
  88. /* ----- VS_VERSION.dwFileFlags ----- */
  89. #define    VS_FF_DEBUG        0x00000001L
  90. #define    VS_FF_PRERELEASE    0x00000002L
  91. #define    VS_FF_PATCHED        0x00000004L
  92. #define    VS_FF_PRIVATEBUILD    0x00000008L
  93. #define    VS_FF_INFOINFERRED    0x00000010L
  94. #define    VS_FF_SPECIALBUILD    0x00000020L
  95.  
  96. /* ----- VS_VERSION.dwFileOS ----- */
  97. #define    VOS_UNKNOWN        0x00000000L
  98. #define    VOS_DOS            0x00010000L
  99. #define    VOS_OS216        0x00020000L
  100. #define    VOS_OS232        0x00030000L
  101. #define    VOS_NT            0x00040000L
  102.  
  103. #define    VOS__BASE        0x00000000L
  104. #define    VOS__WINDOWS16        0x00000001L
  105. #define    VOS__PM16        0x00000002L
  106. #define    VOS__PM32        0x00000003L
  107. #define    VOS__WINDOWS32        0x00000004L
  108.  
  109. #define    VOS_DOS_WINDOWS16    0x00010001L
  110. #define    VOS_DOS_WINDOWS32    0x00010004L
  111. #define    VOS_OS216_PM16        0x00020002L
  112. #define    VOS_OS232_PM32        0x00030003L
  113. #define    VOS_NT_WINDOWS32    0x00040004L
  114.  
  115. /* ----- VS_VERSION.dwFileType ----- */
  116. #define    VFT_UNKNOWN        0x00000000L
  117. #define    VFT_APP            0x00000001L
  118. #define    VFT_DLL            0x00000002L
  119. #define    VFT_DRV            0x00000003L
  120. #define    VFT_FONT        0x00000004L
  121. #define    VFT_VXD            0x00000005L
  122. #define    VFT_STATIC_LIB        0x00000007L
  123.  
  124. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV ----- */
  125. #define    VFT2_UNKNOWN        0x00000000L
  126. #define VFT2_DRV_PRINTER    0x00000001L
  127. #define    VFT2_DRV_KEYBOARD    0x00000002L
  128. #define    VFT2_DRV_LANGUAGE    0x00000003L
  129. #define    VFT2_DRV_DISPLAY    0x00000004L
  130. #define    VFT2_DRV_MOUSE        0x00000005L
  131. #define    VFT2_DRV_NETWORK    0x00000006L
  132. #define    VFT2_DRV_SYSTEM        0x00000007L
  133. #define    VFT2_DRV_INSTALLABLE    0x00000008L
  134. #define    VFT2_DRV_SOUND        0x00000009L
  135. #define    VFT2_DRV_COMM        0x0000000AL
  136.  
  137. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT ----- */
  138. #define VFT2_FONT_RASTER    0x00000001L
  139. #define    VFT2_FONT_VECTOR    0x00000002L
  140. #define    VFT2_FONT_TRUETYPE    0x00000003L
  141.  
  142. /* ----- VerFindFile() flags ----- */
  143. #define VFFF_ISSHAREDFILE    0x0001
  144.  
  145. #define VFF_CURNEDEST        0x0001
  146. #define VFF_FILEINUSE        0x0002
  147. #define VFF_BUFFTOOSMALL    0x0004
  148.  
  149. /* ----- VerInstallFile() flags ----- */
  150. #define VIFF_FORCEINSTALL    0x0001
  151. #define VIFF_DONTDELETEOLD    0x0002
  152.  
  153. #define VIF_TEMPFILE        0x00000001L
  154. #define VIF_MISMATCH        0x00000002L
  155. #define VIF_SRCOLD        0x00000004L
  156.  
  157. #define VIF_DIFFLANG        0x00000008L
  158. #define VIF_DIFFCODEPG        0x00000010L
  159. #define VIF_DIFFTYPE        0x00000020L
  160.  
  161. #define VIF_WRITEPROT        0x00000040L
  162. #define VIF_FILEINUSE        0x00000080L
  163. #define VIF_OUTOFSPACE        0x00000100L
  164. #define VIF_ACCESSVIOLATION    0x00000200L
  165. #define VIF_SHARINGVIOLATION    0x00000400L
  166. #define VIF_CANNOTCREATE    0x00000800L
  167. #define VIF_CANNOTDELETE    0x00001000L
  168. #define VIF_CANNOTRENAME    0x00002000L
  169. #define VIF_CANNOTDELETECUR    0x00004000L
  170. #define VIF_OUTOFMEMORY        0x00008000L
  171.  
  172. #define VIF_CANNOTREADSRC    0x00010000L
  173. #define VIF_CANNOTREADDST    0x00020000L
  174.  
  175. #define VIF_BUFFTOOSMALL    0x00040000L
  176.  
  177. #ifndef RC_INVOKED              /* RC doesn't need to see the rest of this */
  178.  
  179. /* ----- Types and structures ----- */
  180.  
  181. typedef signed short int SHORT;
  182.  
  183. typedef struct tagVS_FIXEDFILEINFO
  184. {
  185.     DWORD   dwSignature;            /* e.g. 0xfeef04bd */
  186.     DWORD   dwStrucVersion;         /* e.g. 0x00000042 = "0.42" */
  187.     DWORD   dwFileVersionMS;        /* e.g. 0x00030075 = "3.75" */
  188.     DWORD   dwFileVersionLS;        /* e.g. 0x00000031 = "0.31" */
  189.     DWORD   dwProductVersionMS;     /* e.g. 0x00030010 = "3.10" */
  190.     DWORD   dwProductVersionLS;     /* e.g. 0x00000031 = "0.31" */
  191.     DWORD   dwFileFlagsMask;        /* = 0x3F for version "0.42" */
  192.     DWORD   dwFileFlags;            /* e.g. VFF_DEBUG | VFF_PRERELEASE */
  193.     DWORD   dwFileOS;               /* e.g. VOS_DOS_WINDOWS16 */
  194.     DWORD   dwFileType;             /* e.g. VFT_DRIVER */
  195.     DWORD   dwFileSubtype;          /* e.g. VFT2_DRV_KEYBOARD */
  196.     DWORD   dwFileDateMS;           /* e.g. 0 */
  197.     DWORD   dwFileDateLS;           /* e.g. 0 */
  198. } VS_FIXEDFILEINFO;
  199.  
  200. /* ----- Function prototypes ----- */
  201.  
  202. UINT WINAPI VerFindFile(UINT uFlags, LPCSTR szFileName,
  203.       LPCSTR szWinDir, LPCSTR szAppDir,
  204.       LPSTR szCurDir, UINT FAR* lpuCurDirLen,
  205.       LPSTR szDestDir, UINT FAR* lpuDestDirLen);
  206.  
  207. DWORD WINAPI VerInstallFile(UINT uFlags,
  208.       LPCSTR szSrcFileName, LPCSTR szDestFileName, LPCSTR szSrcDir,
  209.       LPCSTR szDestDir, LPCSTR szCurDir, LPSTR szTmpFile, UINT FAR* lpuTmpFileLen);
  210.  
  211. /* Returns size of version info in bytes */
  212. DWORD WINAPI GetFileVersionInfoSize(
  213.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  214.       DWORD FAR *lpdwHandle);   /* Information for use by GetFileVersionInfo */
  215.  
  216. /* Read version info into buffer */
  217. BOOL WINAPI GetFileVersionInfo(
  218.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  219.       DWORD dwHandle,           /* Information from GetFileVersionSize */
  220.       DWORD dwLen,              /* Length of buffer for info */
  221.       void FAR* lpData);        /* Buffer to place the data structure */
  222.  
  223. /* Returns size of resource in bytes */
  224. DWORD WINAPI GetFileResourceSize(
  225.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  226.       LPCSTR lpstrResType,      /* Type:  normally VS_FILE_INFO */
  227.       LPCSTR lpstrResID,        /* ID:  normally VS_VERSION_INFO */
  228.       DWORD FAR *lpdwFileOffset); /* Returns file offset of resource */
  229.  
  230. /* Reads file resource into buffer */
  231. BOOL WINAPI GetFileResource(
  232.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  233.       LPCSTR lpstrResType,      /* Type:  normally VS_FILE_INFO */
  234.       LPCSTR lpstrResID,        /* ID:  normally VS_VERSION_INFO */
  235.       DWORD dwFileOffset,       /* File offset or NULL */
  236.       DWORD dwResLen,           /* Length of resource to read or NULL */
  237.       void FAR* lpData);        /* Pointer to data buffer */
  238.  
  239. UINT WINAPI VerLanguageName(UINT wLang, LPSTR szLang, UINT nSize);
  240.  
  241. UINT WINAPI GetWindowsDir(LPCSTR szAppDir, LPSTR lpBuffer, int nSize);
  242.  
  243. UINT WINAPI GetSystemDir(LPCSTR szAppDir, LPSTR lpBuffer, int nSize);
  244.  
  245. BOOL WINAPI VerQueryValue(const void FAR* pBlock, LPCSTR lpSubBlock,
  246.       void FAR* FAR* lplpBuffer, UINT FAR* lpuLen);
  247.  
  248. #ifdef __cplusplus
  249. }
  250. #endif    /* __cplusplus */
  251.  
  252. #pragma pack()
  253.  
  254. #endif  /* !RC_INVOKED */
  255. #endif  /* !_INC_VER */
  256.